#=========================================================================
# Copyright (C) 2022 The C++ Component Model(COMO) Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=========================================================================

project(RPCTestComponent CXX)

set(COMPONENT_SRC_DIR ${RPC_SAMPLE_SRC_DIR}/component)
set(COMPONENT_OBJ_DIR ${RPC_SAMPLE_OBJ_DIR}/component)

include_directories(
    ./
    ${INC_DIR}
    ${COMPONENT_OBJ_DIR}
    ${EXTERNAL_DIR}/libzmq/include
)

set(SOURCES
    CService.cpp)

COMPILE_COMO_COMPONENT("${COMPONENT_SRC_DIR}/RPCTestUnit.cdl" ${COMPONENT_OBJ_DIR} GENERATED_SOURCES)

IMPORT_LIBRARY(comort.so)

add_library(RPCTestUnit
    SHARED
    ${SOURCES}
    ${GENERATED_SOURCES})
target_link_libraries(RPCTestUnit comort.so)

# Dependent targets are provided by the COMO environment (SDK) and needn't
# add_dependencies to comort.so
#add_dependencies(RPCTestUnit comort)

COPY(RPCTestUnit ${COMPONENT_OBJ_DIR}/RPCTestUnit.so ${SAMPLES_BIN_DIR})
